﻿using System;
using System.Web.Hosting;

namespace UDS.Components
{
    public class DocAttachFile
    {
        #region AttachDir & TempAttachDir

        private static string s_attachDir;

        /// <summary>
        /// Gets the virtual directory where the attachment files are stored.
        /// </summary>
        public const string AttachVDir = @"~\Files\DocumentFlow\AttachFiles\";

        public const string TempAttachVDir = AttachVDir + @"tmp\";

        /// <summary>
        /// Gets the physical path to the directory where the attachment files are stored.
        /// </summary>
        public static string AttachDir
        {
            get
            {
                if (s_attachDir == null)
                {
                    var dir = HostingEnvironment.MapPath(AttachVDir);
                    if (string.IsNullOrEmpty(dir))
                    {
                        throw new InvalidOperationException("The attachment directory cannot be found.");
                    }
                    s_attachDir = dir;
                }

                return s_attachDir;
            }
        }

        public static string TempAttachDir
        {
            get { return AttachDir + @"tmp\"; }
        }

        #endregion

        /// <summary>
        /// 文件ID
        /// </summary>
        public int FileID
        {
            get;
            set;
        }

        /// <summary>
        /// 文档ID
        /// </summary>
        public int DocID
        {
            get;
            set;
        }

        public string FileName
        {
            //文件名
            get;
            set;
        }

        public int FileSize
        {
            //文件大小
            get;
            set;
        }

        public int FileAttribute
        {
            //文件属性
            get;
            set;
        }

        public string FileVisualPath
        {
            //文件虚拟路径
            get;
            set;
        }

        public string FileAuthor
        {
            //文件作者
            get;
            set;
        }

        public string FileCatlog
        {
            //文件类别
            get;
            set;
        }

        public string FileAddedDate
        {
            //文件添加日期
            get;
            set;
        }
    }
}